﻿using log4net;
using log4net.Config;
using System;
namespace vtech_frameWorks.Library
{
    public enum LogLevel
    {
        DEBUG=0,
        ERROR=1,
        FATAL=2,
        INFO=3,
        WARN=4
    }

    public static class ClsLogServices
    {
        #region Members
        private static readonly ILog logger = LogManager.GetLogger(typeof(ClsLogServices));
        #endregion

        #region Constructors
        static ClsLogServices()
        {
            BasicConfigurator.Configure();
            XmlConfigurator.Configure();
        }
        #endregion

        #region Methods
        public static void WriteLog(LogLevel logLevel, String log)
        {
            if (logLevel.Equals(LogLevel.DEBUG))
                logger.Debug(log);
            else if (logLevel.Equals(LogLevel.ERROR))
                logger.Error(log);
            else if (logLevel.Equals(LogLevel.FATAL))
                logger.Fatal(log);
            else if (logLevel.Equals(LogLevel.INFO))
                logger.Info(log);
            else if (logLevel.Equals(LogLevel.WARN))
                logger.Warn(log);
        }
        #endregion
    }
}
